<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="plujins/bootstrap-3.3.7-dist/css/bootstrap.min.css">
    <style>
        .container-fluid{
            background-color: pink;
            height: 200px;
        }
    </style>
    <title>模态框</title>
</head>
<body>
<div class="container">
    <h2>创建模态框modal</h2>
    <button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">演示模态框</button>
    <button class="btn btn-primary btn-lg" id="btn">演示模态框2</button>
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">添加用户</h4>
                </div>
                <div class="modal-body">
                    <form action="#" class="form-horizontal" role="form">
                        <div class="form-group">
                            <label for="name" class="col-md-2 control-label">姓名</label>
                            <div class="col-md-8">
                                <input type="text" id="name" class="form-control" placeholder="请输入姓名">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="password" class="col-md-2 control-label">密码</label>
                            <div class="col-md-8">
                                <input type="text" id="password" class="form-control" placeholder="请输入密码">
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary" id="submit_btn">提交更改</button>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script src="js/jquery-3.2.js"></script>
<script src="plujins/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
<script>
    $("#btn").click(function (){
        $("#myModal").modal("show")
        $(this).addClass("yaotijiaodedian")
    })
    $("#submit_btn").click(function (){
        $("#myModal").modal("hide")
        console.log($(".yaotijiaodedian").attr("id"));
    })
</script>
</html>